<template>
	<view class="mag-page">
		<view class="msg-top">
			<view :class="current == 0 && 'act'" @click="handleCurrent(0)">已读</view>
			<view :class="current == 1 && 'act'" @click="handleCurrent(1)">未读</view>
		</view>
		<view class="content" v-if="current == 0">
			<view class="item" v-for="(item, index) in lists" :key="index">
				<view class="item-top">
					<view class="item-title">{{item.title}}</view>
					<view class="item-time">{{item.date}}</view>
				</view>
				<view class="item-content">{{item.msg}}</view>
			</view>
		</view>
		<no-data v-if="lists.length === 0 || current == 1"></no-data>
	</view>
</template>

<script>
	import noData from '../../../components/noData/index.vue'
	export default{
		components: {
			noData
		},
		data() {
			return {
				current: 0,
				lists: []
			}
		},
		mounted() {
			this.getData()
		},
		methods: {
			handleCurrent(num) {
				this.current = num
			},
			async getData() {
				uni.showLoading({
					title: '加载中',
					mask: true
				})

				uni.hideLoading()
			},
		}
	}
</script>

<style scoped>
	.msg-page{
		height: 100vh;
		display: flex;
		flex-direction: column;
	}
	.msg-top{
		height: 70rpx;
		color: #fff;
		background: #0084FF;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.msg-top view{
		width: 200rpx;
		text-align: center;
		position: relative;
	}
	.act::before{
		content: '';
		position: absolute;
		bottom: -10rpx;
		left: 50%;
		margin-left: -50rpx;
		width: 100rpx;
		height: 4rpx;
		background: #FFFFFF;
		border-radius: 2rpx;
	}
	.content{
		flex: 1;
		padding: 0 36rpx;
		border-bottom: 1px solid #E5E5E5;
	}
	.item{
		padding: 40rpx 0;
	}
	.item-top{
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-bottom: 40rpx;
	}
	.item-title{
		color: #000000;
		font-size: 32rpx;
	}
	.item-time{
		color: #999999;
		font-size: 28rpx;
	}
	.item-content{
		color: #333333;
		font-size: 28rpx;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}
</style>
